﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public partial class 修改图书 : Form
    {
        string ID = "";
        public 修改图书()
        {
            InitializeComponent();
        }
        public 修改图书(string id,string name,string author,string press,string number)
        {
            InitializeComponent();
            ID= textBox1.Text = id;
            textBox2.Text = name;
            textBox3.Text = author;
            textBox4.Text = press;
            textBox5.Text = number;


        }
        private void button1_Click(object sender, EventArgs e)
        {
            string sql = $"update t_book set id='{textBox1.Text}',[name] = '{textBox2.Text}',author = '{textBox3.Text}',press = '{textBox4.Text}',number ={textBox5.Text} where id = '{ID}'";//需要复制写在数据库的
            Dao dao = new Dao();
            if (dao.Execute(sql) > 0) 
            {
                MessageBox.Show("修改成功");
                    this.Close();
            }
        }

        private void 修改图书_Load(object sender, EventArgs e)
        {

        }
    }
}
